from django.contrib import admin
from mysite.books.models import Publisher, Author, Book

class AuthorAdmin(admin.ModelAdmin):
	list_display = ('first_name', 'last_name', 'email',)
	search_fields = ('first_name', 'last_name', 'email',)
class Author_search_admin(admin.ModelAdmin):
	search_fields = ('first_name', 'last_name', 'email',)


class PublisherAdmin(admin.ModelAdmin):
	list_display = ('name','city','website',)

class BookAdmin(admin.ModelAdmin):
	list_display = ('title', 'publisher', 'publication_date',)
	list_filter = ('publication_date',)
	date_hierarchy = 'publication_date'
	ordering = ( '-publication_date',)
	#fields = ('title', 'authors', 'publisher', 'publication_date',)
	#fields = ('title', 'authors', 'publisher',)
	filter_horizontal = ('authors',)
	#filter_vertical = ('authors',)
	#raw_id_fields = ('publisher',)
admin.site.register(Publisher,PublisherAdmin)
admin.site.register(Author,AuthorAdmin)
#admin.site.register(Author,Author_search_admin)
admin.site.register(Book,BookAdmin)

